# https://www.bilibili.com/video/BV1W7411G7wP?p=17&spm_id_from=pageDriver&vd_source=8bd7b24b38e3e12c558d839b352b32f4
import pandas as pd

students = pd.read_excel('../resources/input_py_tools/017/Students.xlsx')
print(students)

def score_validation_type01(row):
    try:
        assert 0 <= row.Score <= 100
    except:
        print(f'#{row.ID}\tstudent {row.Name} has an invalid score {row.Score}')

print('====================校验结果：')
# axis=1 按行校验
students.apply(score_validation_type01, axis=1)


def score_validation_type02(row):
    if not 0 <= row.Score <= 100:
        print(f'#{row.ID}\tstudent {row.Name} has an invalid score {row.Score}')

print('====================校验结果：')
# axis=1 按行校验
students.apply(score_validation_type02, axis=1)
